/**
 * 出库明细表js
 */

$(function () {
	initialPage();
});

function initialPage() {
	$(window).resize(function() {
		$('#dataGridForOutBoundPrint').bootstrapTable('resetView');
	});
}

var vm = new Vue({
	el:'#dpLTE',
	data: {
        operator: {},
        outBound: {
            id: 0,
            outBoundDate: new Date(),
            outBoundNumber: {},
            outBoundPeople: {},
            customer: {},
            outTypeCode:{},
            outBoundAmount: {}
        },
	},
	methods : {
		load: function() {
			$('#dataGridForOutBoundPrint').bootstrapTable('refresh');
		},
        getGrid: function () {
            $('#dataGridForOutBoundPrint').bootstrapTable({
                url: '../../../outboundDetails/listNoPage',
                method: 'post',
                dataType: 'json',
                queryParamsType : null,
                pagination: false,
                queryParams: function(params){
                    params.outBoundId = vm.outBound.id;
                    return params;
                },
                columns: [
                    {field : "name", title : "商品名称", width : "100px"},
                    {field : "specification", title : "商品规格", width : "100px"},
                    {field : "unit", title : "商品单位", width : "100px"},
                    {field : "manufacturer", title : "生产厂家", width : "100px"},
                    {field : "deptName", title : "库房", width : "100px"},
                    {field : "itemName", title : "项目", width : "100px"},
                    {field : "quantity", title : "出库数量", width : "100px"},
                    {field : "unitPrice", title : "销售单价", width : "100px",
                        formatter : function (value, row, index) {
                            return value.toFixed(2);
                        }
                    },
                    {field : "totalPrice", title : "销售总价", width : "100px",
                        formatter : function (value, row, index) {
                            return value.toFixed(2);
                        }
                    }
                ]
            })
        },
        getUser: function () {
            $.getJSON("/sys/user/info?_" + $.now(), function (r) {
                vm.operator = r.user.realName;
            });
        }
	}
})
vm.getUser();